from rest_framework import serializers

from Spitslot.models import Spitslot_Comment, Spitslots


class SpitslotListSerializer(serializers.ModelSerializer):
    class Meta:
        model = Spitslots
        fields = ['content','sp_like_count','create_time']


class SpitslotCommentSerializer(serializers.ModelSerializer):
    class Meta:
        model = Spitslot_Comment
        fields = ('id', 'like_count', 'spitslot_content')



class SpitslotSerializer(serializers.ModelSerializer):
    spitslot_comment = SpitslotCommentSerializer(many=True)
    class Meta:
        model = Spitslots
        fields = ('id', 'spitslot_comment', 'sp_like_count', 'share_count', 'content', 'index_image_url', 'is_collected'
                  , 'is_like', 'is_cryptonym', 'is_delete')